package com.fimmlps.reronge.dto;

import com.fimmlps.reronge.entity.EntryUsage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class EntryUsageDto {
    private long entryUsageId;
    private long entrySingleId;
    private String text;

    public EntryUsageDto(EntryUsage trigger){
        this.entryUsageId = trigger.getEntryUsageId();
        this.entrySingleId =  trigger.getEntrySingleId();
        this.text = trigger.getText();
    }

    public static List<EntryUsageDto> toDtoList(List<EntryUsage> list){
        ArrayList<EntryUsageDto> dtoList = new ArrayList<>();
        for(EntryUsage trigger:list){
            dtoList.add(new EntryUsageDto(trigger));
        }
        return dtoList;
    }
}
